<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
 <title>Wettersystem</title>
 <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
 <style>

 </style>

        <link rel="stylesheet" type="text/css" href="class/style.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="class/calendar/css/page.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="class/calendar/css/calendar-eightysix-v1.1-default.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="class/calendar/css/calendar-eightysix-v1.1-vista.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="class/calendar/css/calendar-eightysix-v1.1-osx-dashboard.css" media="screen" />
        <script type="text/javascript" src="class/calendar/js/mootools-1.2.4-core.js"></script>
        <script type="text/javascript" src="class/calendar/js/mootools-1.2.4.4-more.js"></script>
        <script type="text/javascript" src="class/calendar/js/calendar-eightysix-v1.1.js"></script>
        <script type="text/javascript" src="class/JavaScript/tabs.js"></script>



</head>
<body>

<!-- 
TODO:
Farbe von Trendkurven, Temperatur fett wenn statistische Funktionen
Anzeige von aktuellen Werten

Windchill
Pressure Charts
Forecasts


Externe Satellitenbilder
Design überarbeiten
Ordnerstruktur aufräumen

Charts auf einzelne Dateien aufsplitten: z.b. TemperatureChartDaily
Localization
Code Cleanup
-->

<?php
include ("testlib.php");
  include("Trend/class/FetchValues.php");
  $db = connectToDB();
$Tree=buildtree2();
?>

<table style='border: 2px solid #FFFFFF;'><tr><td>
<div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848;'>&nbsp;Navigation</div>
<table style='padding: 1px; background-color: #E0E0E0; border: 1px solid #D0D0D0; border-top: 1px solid #FFFFFF;'><tr>
 <td width=16><img src='pictures/application_view_tile.png' width=16 height=16 alt=''/></td>
 <td width=100>&nbsp;<b>Wettertrends</b></td>
 <td width=16><img src='pictures/application_view_list.png' width=16 height=16 alt=''/></td>
 <td width=100>&nbsp;<a class=smallLinkGrey href='index.php'>Historische Daten</a></td>
 <td width=16><img src='pictures/application_view_list.png' width=16 height=16 alt=''/></td>
 <td width=100>&nbsp;<a class=smallLinkGrey href='index.php'>Aktuelle Daten</a></td>
 <td width=16><img src='pictures/application_view_list.png' width=16 height=16 alt=''/></td>
 <td width=100>&nbsp;<a class=smallLinkGrey href='index.php'>Wetterkarten</a></td>
</tr></table>
</td></tr></table>

<br/>
<table><tr><td valign='top'>

<?php /* WETTER MENU */ ?>

<table style='border: 2px solid #FFFFFF;'><tr><td>
<div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848; width: 222px;'>&nbsp;Release <?php echo $Version; ?></div>
<div style='border: 3px solid #D0D0D0; border-top: 1px solid #FFFFFF; background-color: #FAFAFA; width: 220px; overflow: auto'>
<div style='padding: 1px; padding-bottom: 3px; color: #000000; background-color:#D0D0D0;'>
 <table><tr>
  <td><img src='pictures/application_view_list.png' width=16 height=16 alt=''/></td>
  <td>&nbsp;Wettermenu</td>
 </tr></table>
</div>
<?php
  $ID = 1; if ( isset($Tree["z_root"]) ) { $ID = 2; }
  foreach($Tree as $Key => $Elements)
   {
    if ( $ID == count($Tree) ) { $Icon = "dash-explorer-last.png"; $SubIcon = "dash-explorer-blank.png"; } else { $Icon = "dash-explorer.png"; $SubIcon = "dash-explorer-noleaf.png"; }
    if ( $Key != "z_root" )
     {
      echo "<table  noborder cellpadding=0 cellspacing=0>\r\n";
      echo " <tr valign=middle>\r\n";
      echo "  <td><img src='pictures/".$Icon."' width=16 height=20 alt=''/></td>\r\n";
      echo "  <td><img src='pictures/folder.png' width=16 height=16 alt=''/></td>\r\n";
      echo "  <td><div class=folder id='".$Key."_main' onclick='showHideMenu(".chr(34).$Key.chr(34).");'>&nbsp;".$Key."</div></td>\r\n";
      echo " </tr>\r\n";
      echo "</table>\r\n";

      echo "<table id='".$Key."' style='display: none;' noborder cellpadding=0 cellspacing=0><tr>\r\n";
      foreach($Elements as $SubKey => $Element)
       {
        $Draw = $Element["SensorID"];
        $Node = $Element["Element"];

        if ( $SubKey == count($Elements)-1 ) { $Icon = "dash-explorer-last.png"; } else { $Icon = "dash-explorer.png"; }

        echo " <tr valign=middle>\r\n";
        echo "  <td><img src='pictures/".$SubIcon."' width=16 height=20 alt=''/></td>\r\n";
        echo "  <td><img src='pictures/".$Icon."' width=16 height=20 alt=''/></td>\r\n";

        echo "  <td><img src='pictures/application_view_tile.png' width=16 height=16 alt=''/></td>\r\n";
        echo "  <td>&nbsp;<a class=smallLinkGrey href='#' onclick='loadCal(".chr(34)."Day".chr(34)."); showNavMenu(); drawfirst(".chr(34).$Draw.chr(34).");'>".$Node."</a></td>\r\n";
 
        echo " </tr>\r\n";
  




       }
      echo "</table>\r\n";

     }
    $ID++;
   }
$result=fetchActualData(0);
$row = mysql_fetch_row($result);
?>
</div>
</td></tr></table>

<?php /* WEATHER FORECAST TABLE */ ?>
     <!-- OK unten -->
<table style='border: 2px solid #FFFFFF;'><tr><td>
<div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848; width: 222px;'>&nbsp;Menu2 </div>
<div style='border: 3px solid #D0D0D0; border-top: 1px solid #FFFFFF; background-color: #FAFAFA; width: 220px; overflow: auto'>
<div style='padding: 1px; padding-bottom: 3px; color: #000000; background-color:#D0D0D0;'>
 <table><tr>
  <td><img src='pictures/application_view_list.png' width=16 height=16 alt=''/></td>
  <td>&nbsp;Weather Forecast
  </td>
 </tr></table>
</div>
Hier kommt bald der <br>
Weather Forecast !!!
</div>
</td></tr></table>


<?php /* MIDDLE DIV*/ ?>


</td><td width=20></td><td valign='top' style='padding-top: 5px; font-size: 12px;'>

<table><tr>
 

<!-- ANFANG NEUES MENÜ -->



<div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848; width: 222px;'>&nbsp;Menu2 </div>
<div style='border: 3px solid #D0D0D0; border-top: 1px solid #FFFFFF; background-color: #FAFAFA; width: 220px; overflow: auto'>
<div style='padding: 1px; padding-bottom: 3px; color: #000000; background-color:#D0D0D0;'>

<table class="NoneFormater" style="border: 0px solid rgb(0, 0, 0); height: auto; width: 100%; empty-cells: show;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(230, 230, 230) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 1px; vertical-align: middle; text-align: center; width: 44%; background-color: rgb(230, 230, 230);">Temperatur ( +2 m Höhe )</td>
<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 0px; vertical-align: middle; text-align: center; width: 5%; background-color: rgb(230, 230, 230);"><a id="thumb1" href="/wetter/temp_tau_heute.png" class="highslide" onclick="return hs.expand(this, { captionText: '' } )"><img src="/wetter/grafiken/grafik.png" alt="" title="Grafik Temperatur" style="border-style: none"/></a></td>
<td style="border-style: solid; border-color: rgb(255, 255, 255) rgb(204, 204, 204) rgb(255, 255, 255) rgb(204, 204, 204); border-width: 1px 0px 1px 0px; vertical-align: middle; text-align: center; width: 2%;">&nbsp;</td>

<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(230, 230, 230) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 1px; vertical-align: middle; text-align: center; width: 44%; background-color: rgb(230, 230, 230);">Niederschlag</td>
<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 0px;; vertical-align: middle; text-align: center; width: 5%; background-color: rgb(230, 230, 230);"><a id="thumb2" href="/wetter/regen_heute.png" class="highslide" onclick="return hs.expand(this, { captionText: '' } )"><img src="/wetter/grafiken/grafik.png" alt="" title="Grafik Niederschlag" style="border-style: none"/></a></td>

<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(230, 230, 230) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 1px; vertical-align: middle; text-align: center; width: 44%; background-color: rgb(230, 230, 230);">Niederschlag</td>
<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 0px;; vertical-align: middle; text-align: center; width: 5%; background-color: rgb(230, 230, 230);"><a id="thumb2" href="/wetter/regen_heute.png" class="highslide" onclick="return hs.expand(this, { captionText: '' } )"><img src="/wetter/grafiken/grafik.png" alt="" title="Grafik Niederschlag" style="border-style: none"/></a></td>


</tr>
</tbody>
</table>

<table class="NoneFormater" style="border: 0px solid rgb(0, 0, 0); height: auto; width: 100%; empty-cells: show;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 0px 1px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;<br /></td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 35%;"><span style="color: rgb(67, 129, 13)">Aktuell <img src="http://www.ibb-wetter.de/wetter/grafiken/trend0.gif"  alt="Temperatur-Trend" title="Temperatur-Trend"</span></td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: right; width: 12%;"><span style="color: rgb(67, 129, 13)"><?php echo $row[1]; ?> °C</span></td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-width: 0px 1px 0px 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 2%;">&nbsp;</td>

<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 0px 1px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 35%;"><span style="color: rgb(67, 129, 13)">Aktuell</span></td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: right; width: 12%;"><span style="color: rgb(67, 129, 13)">0.0  mm/h</span></td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-width: 0px 1px 0px 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;<br /></td>
</tr>
<tr>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 0px 1px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 35%;"><span style="color: rgb(168, 44, 44);">Maximum, um 15:03h</span></td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: right; width: 12%;"><span style="color: rgb(168, 44, 44);">16.3  °C</span></td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-width: 0px 1px 0px 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 2%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 0px 1px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 35%;"><span style="color: rgb(168, 44, 44);">Maximum, um 00:00h</span></td>

<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: right; width: 12%;"><span style="color: rgb(168, 44, 44);">0.0  mm/h</span></td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-width: 0px 1px 0px 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
</tr>
<tr>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 0px 1px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 35%;"><span style="color: rgb(42, 105, 168);">Minimum, um 06:55h</span></td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: right; width: 12%;"><span style="color: rgb(42, 105, 168);">1.5  °C</span></td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-width: 0px 1px 0px 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 2%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 0px 0px 1px 1px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 1px; vertical-align: middle; height: 12px; text-align: left; width: 35%;">Total heute</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 1px; vertical-align: middle; height: 12px; text-align: right; width: 12%;">2.10  mm</td>

<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(204, 204, 204) rgb(0, 0, 0); border-width: 0px 1px 1px 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
</tr>
<tr>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 0px 0px 1px 1px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 1px; vertical-align: middle; height: 12px; text-align: left; width: 35%;">Windchill (gefühlte Temp.)</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px 0px 1px; vertical-align: middle; height: 12px; text-align: right; width: 12%;">10.0  °C</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(204, 204, 204) rgb(0, 0, 0); border-width: 0px 1px 1px 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border: 0px solid rgb(0, 0, 0); vertical-align: middle; height: 12px; text-align: left; width: 2%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px; vertical-align: middle; height: 12px; text-align: left; width: 35%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-width: 0px; vertical-align: middle; height: 12px; text-align: left; width: 12%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(0, 0, 0) rgb(204, 204, 204) rgb(204, 204, 204) rgb(0, 0, 0); border-width: 0px; vertical-align: middle; height: 12px; text-align: left; width: 1%;">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</div>

</div>






<div><span style="font-size:40%">&nbsp</span></div>

<table class="NoneFormater" style="border: 0px solid rgb(0, 0, 0); height: auto; width: 100%; empty-cells: show;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(230, 230, 230) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 1px; vertical-align: middle; text-align: center; width: 44%; background-color: rgb(230, 230, 230);">Wind</td>
<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 0px; vertical-align: middle; text-align: center; width: 5%; background-color: rgb(230, 230, 230);"><a id="thumb3" href="/wetter/wind_heute.png" class="highslide" onclick="return hs.expand(this, { captionText: '' } )"><img src="/wetter/grafiken/grafik.png" alt="" title="Grafik Wind" style="border-style: none"/></a></td>
<td style="border-style: solid; border-color: rgb(255, 255, 255) rgb(204, 204, 204) rgb(255, 255, 255) rgb(204, 204, 204); border-width: 1px 0px 1px 0px; vertical-align: middle; text-align: center; width: 2%;">&nbsp;</td>
<td style="border-style: solid; border-color: rgb(204, 204, 204) rgb(230, 230, 230) rgb(204, 204, 204) rgb(204, 204, 204); border-width: 1px 1px 1px 1px; vertical-align: middle; text-align: center; width: 44%; background-color: rgb(230, 230, 230);">Windböen</td>
<td style="vertical-align: middle; text-align: center; width: 5%; background-color: #e6e6e6;"><a id="thumb2" class="highslide" href="/wetter/windboen_heute.png" onclick="return hs.expand(this, { captionText: '' } )"><img src="/wetter/grafiken/grafik.png" border="0" title="Grafik Windboen" style="border-style: none" /></a></td>
</tr>
</tbody>
</table>



<!-- ENDE NEUES MENÜ -->









</td></tr></table>
</body>
<script language="JavaScript" type="text/javascript">
 URL        = "";
 SourceURL  = "";
 LastOpened = "";


function showNavMenu()
{

my_div = document.getElementById('tabMenu');
my_div.style.visibility = "visible"; 
}


function drawfirst(Draw)
{

  Id=Draw;
  
  drawTrendAgain();
  //render_with_params('loadChart.php', 'SensorID='+Draw+'&Start='+pickedDate.format('%Y-%m-%d')+'&Type=Day&Show=day_temp_avg');
}

function showReportMenu()
{
var container = document.getElementById("tabContainer");
container.style.display="none";

}

function drawTrendAgain()
{
cbResults = "";

 switch(reportType)
 {
 
  case "Day":
  			// get Checkbox status
            for (var i = 0; i < document.forms.dayform.elements.length; i++ ) 
	            if (document.forms.dayform.elements[i].checked == true) 
	                cbResults += document.forms.dayform.elements[i].id + ' ';
              
            if (cbResults.length < 1)
		    {
		    	alert ("Es wurden keine Trendkurven ausgewaehlt!");
		    	exit;
		    }
		    
            pickedDate=dailyCalendar.getDate();
            render_with_params('loadChart.php', 'SensorID='+Id+'&Start='+pickedDate.format('%Y-%m-%d')+'&Type='+reportType+'&Show='+cbResults);
  break;

  case "Week":
    			// get Checkbox status
            for (var i = 0; i < document.forms.weekform.elements.length; i++ ) 
	            if (document.forms.weekform.elements[i].checked == true) 
	                cbResults += document.forms.weekform.elements[i].id + ' ';
            if (cbResults.length < 1)
		    {
		    	alert ("Es wurden keine Trendkurven ausgewaehlt!");
		    	exit;
		    }
         pickedDate=weeklyCalendar.getDate();
        render_with_params('loadChart.php', 'SensorID='+Id+'&Start='+pickedDate.format('%Y-%m-%d')+'&Type='+reportType+'&Show='+cbResults);

  break;

  case "Month":
            for (var i = 0; i < document.forms.monthform.elements.length; i++ ) 
	            if (document.forms.monthform.elements[i].checked == true) 
	                cbResults += document.forms.monthform.elements[i].id + ' ';
            if (cbResults.length < 1)
		    {
		    	alert ("Es wurden keine Trendkurven ausgewaehlt!");
		    	exit;
		    }
        pickedDate=monthlyCalendar.getDate();
        render_with_params('loadChart.php', 'SensorID='+Id+'&Start='+pickedDate.format('%Y-%m-%d')+'&Type='+reportType+'&Show='+cbResults);

  break;

  case "Year":
            for (var i = 0; i < document.forms.yearform.elements.length; i++ ) 
	            if (document.forms.yearform.elements[i].checked == true) 
	                cbResults += document.forms.yearform.elements[i].id + ' ';
            if (cbResults.length < 1)
		    {
		    	alert ("Es wurden keine Trendkurven ausgewaehlt!");
		    	exit;
		    }
        pickedDate=yearlyCalendar.getDate();
        render_with_params('loadChart.php', 'SensorID='+Id+'&Start='+pickedDate.format('%Y-%m-%d')+'&Type='+reportType+'&Show='+cbResults);

  break;

  default:
  break;
}

}

function showReportMenu()
{
var ele = document.getElementById("navmenu");
ele.style.display = "";
}



function loadCal(CalType)
{


 reportType=CalType;

 switch(CalType)
 {
  case "Day":

           document.getElementById('tdCalendar').innerHTML = 'Tag waehlen: <input id="DailyCal" name="dateIII" type="text" maxlength="10" style="padding-right: 22px;" /><div class="picker inElement" id="exampleIII-picker"></div>';
           window.addEvent('domready', function() {
           dailyCalendar = new CalendarEightysix('DailyCal', {'toggler': 'exampleIII-picker', 'offsetY': -4 });
         });

  break;

  case "Week":
           document.getElementById('tdCalendar').innerHTML = 'Woche waehlen: <input id="WeeklyCal" name="dateIII" type="text" maxlength="10" style="padding-right: 22px;" /><div class="picker inElement" id="exampleIII-picker"></div>';
           window.addEvent('domready', function() {
           weeklyCalendar = new CalendarEightysix('WeeklyCal', {'toggler': 'exampleIII-picker', 'offsetY': -4 });
         });

  break;

  case "Month":

           document.getElementById('tdCalendar').innerHTML = 'Monat waehlen: <input id="MonthlyCal" name="dateIII" type="text" maxlength="10" style="padding-right: 22px;" /><div class="picker inElement" id="exampleIII-picker"></div>';
           window.addEvent('domready', function() {
           monthlyCalendar = new CalendarEightysix('MonthlyCal', {'toggler': 'exampleIII-picker', 'offsetY': -4 });
         });

  break;

  case "Year":
          document.getElementById('tdCalendar').innerHTML = 'Monat waehlen: <input id="YearlyCal" name="dateIII" type="text" maxlength="10" style="padding-right: 22px;" /><div class="picker inElement" id="exampleIII-picker"></div>';
           window.addEvent('domready', function() {
           yearlyCalendar = new CalendarEightysix('YearlyCal', {'toggler': 'exampleIII-picker', 'offsetY': -4 });
         });
   break;

  default:
  break;
 }



}



 function showHideMenu(Element)
  {
   status = document.getElementById(Element).style.display;
   if ( status == "none" )
    {
     if ( LastOpened != "" && LastOpened != Element ) { showHideMenu(LastOpened); }
	
     document.getElementById(Element).style.display = "inline";
     document.getElementById(Element+"_main").style.fontWeight = "bold";
     LastOpened = Element;
    }
   else
    {
     document.getElementById(Element).style.display = "none";
     document.getElementById(Element+"_main").style.fontWeight = "normal";
     LastOpened = "";
    }
  }

 function render(PictureName)
  {
   opacity("render",100,0,100);
   Id = (PictureName.substr(PictureName.length - 5, 1)-1);

   RandomKey = Math.random(100);
   URL       = PictureName + "?Seed=" + RandomKey;
   SourceURL = PictureName;

   ajaxRender(URL);
  }

 function render_with_params(PictureName, params)
  {

   opacity("render",100,0,100);
   RandomKey = Math.random(100);
   URL       = PictureName + "?"+params+"&Seed=" + RandomKey;
   SourceURL = PictureName;

   ajaxRender(URL);
  }

 function StartFade()
  {
   Loader     = new Image();
   Loader.src = URL;
   setTimeout("CheckLoadingStatus()", 200);
  }

 function CheckLoadingStatus()
  {
   if ( Loader.complete == true )
    {
     changeOpac(0, "render");
     HTMLResult = "<center><img src='" + URL + "' alt=''/></center>";
     document.getElementById("render").innerHTML = HTMLResult;

     opacity("render",0,100,100);
     view(SourceURL);
    }
   else
    setTimeout("CheckLoadingStatus()", 200);
  }

 function changeOpac(opacity, id)
  {
   var object = document.getElementById(id).style;
   object.opacity = (opacity / 100);
   object.MozOpacity = (opacity / 100);
   object.KhtmlOpacity = (opacity / 100);
   object.filter = "alpha(opacity=" + opacity + ")";
  }

 function wait()
  {
   HTMLResult = "<center><img src='pictures/wait.gif' width=24 height=24 alt=''/><br>Rendering</center>";
   document.getElementById("render").innerHTML = HTMLResult;
   changeOpac(20, "render");
  }

 function opacity(id, opacStart, opacEnd, millisec)
  {
   var speed = Math.round(millisec / 100);
   var timer = 0;

   if(opacStart > opacEnd)
    {
     for(i = opacStart; i >= opacEnd; i--)
      {
       setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
       timer++;
      }
     setTimeout("wait()",(timer * speed));
    }
   else if(opacStart < opacEnd)
    {
     for(i = opacStart; i <= opacEnd; i++)
      {
       setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
       timer++;
      }
    }
  }

 function ajaxRender(URL)
  {
   var xmlhttp=false;
   /*@cc_on @*/
   /*@if (@_jscript_version >= 5)
    try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }
   @end @*/

   if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } }

   if (!xmlhttp && window.createRequest)
    { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }

   xmlhttp.open("GET", URL,true);

   xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { StartFade();  } }
   xmlhttp.send(null)
  }

 function ajaxRender_with_params(URL, params)
  {
   var xmlhttp=false;
   /*@cc_on @*/
   /*@if (@_jscript_version >= 5)
    try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }
   @end @*/

   if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } }

   if (!xmlhttp && window.createRequest)
    { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }

   xmlhttp.open("GET", URL+params,true);

   xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { StartFade();  } }
   xmlhttp.send(null)
  }

 function view(URL)
  {
   var xmlhttp=false;
   /*@cc_on @*/
   /*@if (@_jscript_version >= 5)
    try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }
   @end @*/

   URL = "index.php?Action=View&Script=" + URL;

   if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } }

   if (!xmlhttp && window.createRequest)
    { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }

   xmlhttp.open("GET", URL,true);

   xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { Result = xmlhttp.responseText; document.getElementById("source").innerHTML = Result.replace("/\<BR\>/");  } }
   xmlhttp.send(null)
  }
</script>
</html>